package day2017119;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class test01 {
    public static void main(String[] args) throws IOException {
        String path="D:\\hello.txt";
        //1.字符流来读
        //1.1一次读一行字符
        BufferedReader reader = null;
        try {
             reader=new BufferedReader(new FileReader(path));
            String line="";
            while ((line=reader.readLine())!=null) {
                //line=reader.readLine();
                System.out.println(line);
            }


        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {

            reader.close();
        }
        //2.读字节流
    }
}
